﻿using System;
using System.Collections.ObjectModel;
using Infragistics.Controls.Schedules;

namespace StartupSolution.Views.Schedules
{
    public class SchedulesData
    {
        #region Members

        #region Resources
        private static ObservableCollection<Resource> resources;
        public static ObservableCollection<Resource> Resources
        {
            get
            {
                if (resources == null)
                    resources = CreateResources();

                return resources;
            }
         }
    
        private static ObservableCollection<Resource> CreateResources()
        {
            return new ObservableCollection<Resource>
            {
                new Resource
                {
                    Id = "resource1",
                    Name = "resourceName"
                }
            };
        }
        #endregion Resources

        #region Calendars
        private static ObservableCollection<ResourceCalendar> calendars;
        public static ObservableCollection<ResourceCalendar> Calendars
        {
            get
            {
                if (calendars == null)
                    calendars = CreateCalendars();

                return calendars;
            }
        }

        private static ObservableCollection<ResourceCalendar> CreateCalendars()
        {
            return new ObservableCollection<ResourceCalendar>
            {
                new ResourceCalendar
                {
                    Id = "calendar1",
                    OwningResourceId="resource1"
                }
            };
        }
        #endregion Calendars

        #region Appointments
        private static ObservableCollection<Appointment> appointments;
        public static ObservableCollection<Appointment> Appointments
        {
            get
            {
                if (appointments == null)
                    appointments = CreateAppointments();

                return appointments;
            }
        }

        private static ObservableCollection<Appointment> CreateAppointments()
        {
            return new ObservableCollection<Appointment>
            {
                new Appointment
                {
                    Id = "Appointment1",
                    OwningCalendarId = "calendar1",
                    OwningResourceId = "resource1",
                    Subject = "Morning meeting",
                    Description = "Morning meeting",
                    Start = DateTime.Today.AddHours(8).AddMinutes(30).ToUniversalTime(),
                    End = DateTime.Today.AddHours(9).AddMinutes(45).ToUniversalTime(),
                },

                new Appointment
                {
                    Id = "Appointment2",
                    OwningCalendarId = "calendar1",
                    OwningResourceId = "resource1",
                    Subject = "Lunch",
                    Description = "Lunch",
                    Start = DateTime.Today.AddHours(12).ToUniversalTime(),
                    End = DateTime.Today.AddHours(12).AddMinutes(30).ToUniversalTime(),
                },

                new Appointment
                {
                    Id = "Appointment3",
                    OwningCalendarId = "calendar1",
                    OwningResourceId = "resource1",
                    Subject = "Coffee break",
                    Description = "Coffee break",
                    Start = DateTime.Today.AddHours(14).ToUniversalTime(),
                    End = DateTime.Today.AddHours(14).AddMinutes(15).ToUniversalTime(),
                },

                new Appointment
                {
                    Id = "Appointment4",
                    OwningCalendarId = "calendar1",
                    OwningResourceId = "resource1",
                    Subject = "Business meeting",
                    Description = "Business meeting",
                    Start = DateTime.Today.AddHours(14).AddMinutes(15).ToUniversalTime(),
                    End = DateTime.Today.AddHours(18).AddMinutes(00).ToUniversalTime(),
                }
            };
        }
        #endregion Appointments

        #endregion Members
    }
}
